package com.study;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
import org.springframework.boot.system.*;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

@EnableAsync
@EnableCaching
@EnableScheduling
@SpringBootApplication
@ConfigurationPropertiesScan
public class App {

    public static void main(String[] args) {
        SpringApplication.run(App.class, args);
        ApplicationPid pid = new ApplicationPid();
        System.out.printf("进程ID: %s%n", pid);
        ApplicationHome home = new ApplicationHome();
        System.out.printf("应用运行主目录dir: %s, source: %s%n", home.getDir(), home.getSource());
        System.out.printf("Java Version: %s%n", JavaVersion.getJavaVersion());
        ApplicationTemp temp = new ApplicationTemp();
        System.out.printf("临时目录: %s%n", temp.getDir());

        //SystemProperties 类可以方便地访问系统属性。如果属性不存在，它还会尝试从环境变量中获取。
        System.out.printf("java.home=%s%n", SystemProperties.get("java.home"));
    }
}
